(module input mzscheme
  (provide srl-input%)
  
  (require (lib "mred.ss" "mred")
           (lib "class.ss")
           (lib "defmacro.ss")
           "gui.ss")
  
  (define srl-input%
    (class vertical-pane%
      (init parent)
      (super-new (parent parent))
      
      (public month day year
              time-of-day
              course
              distance
              hours minutes seconds
              pace
              hr
              notes)
      
      (define-handled-fn on-today)
      (define-handled-fn on-pace-calculate)
      
      (define-row run-date-row parent)
      (define-label "Date (MM/DD/YYYY)" run-date-row)
      (define-input month run-date-row)
      (define-msg "/" run-date-row)
      (define-input day run-date-row)
      (define-msg "/" run-date-row)
      (define-input year run-date-row)
      (instantiate button%
        ("Today" run-date-row
                 (lambda (button event) (on-today))))
      
      (define-row time-of-day-row parent)
      (define-label "Time of Day" time-of-day-row)
      (define-input time-of-day time-of-day-row)
      
      (define-row course-row parent)
      (define-label "Course" course-row)
      (define-input course course-row)
      
      (define-row distance-row parent)
      (define-label "Distance" distance-row)
      (define-input distance distance-row)
      (send distance-f set-value "1")
      (define-msg "miles" distance-row)
      
      (define-row run-time-row parent)
      (define-label "Time (HH:MM:SS)" run-time-row)
      (define-input hours run-time-row)
      (send hours-f set-value "0")
      (define-msg ":" run-time-row)
      (define-input minutes run-time-row)
      (send minutes-f set-value "0")
      (define-msg ":" run-time-row)
      (define-input seconds run-time-row)
      (send seconds-f set-value "0")
      
      (define-row pace-row parent)
      (define-label "Pace" pace-row)
      (define-input pace pace-row)
      (instantiate button%
        ("Calculate" pace-row
                     (lambda (button event) (on-pace-calculate))))
      
      (define-row hr-row parent)
      (define-label "Heart Rate" hr-row)
      (define-input hr hr-row)
      (send hr-f set-value "0")
      
      (define-row notes-row parent)
      (define-label "Notes" notes-row)
      (define-input notes notes-row))))